<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>注册页面</title>
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/regis.css" />

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">

		<script type="text/javascript">
     function checkRegis(){
        //得到输入框的内容
        var name = document.getElementById("username").value;
        var pwd = document.getElementById("userpwd").value;
        var newPwd = document.getElementById("reuserpwd").value;
                
        //alert("用户名"+name+"密码"+pwd+"新密码"+newPwd);      	
        if(name==""){
            document.getElementById("divName").innerHTML = "<span style='color=#cc0000 size=12px'>用户名不能为空！！</span>";
      		return false;
        }
        
        if(name.length < 6 || name.length > 20){
           document.getElementById("divName").innerHTML ="<span style='color=#cc0000'>用户名要在6~20位之间!!!</span>";
      	   return false;
        }
        
        document.getElementById("divName").innerHTML ="";
        
        if(pwd==""){
            document.getElementById("divPwd").innerHTML = "<span style='color=#cc0000'>密码不能为空！！!</span>";
      		return false;
        }
        
        if(pwd.length < 6 || pwd.length > 20){
           document.getElementById("divPwd").innerHTML ="<span style='color=#cc0000'>密码要在6~20位之间!!!</span>";
      	   return false;
        }
        
        document.getElementById("divPwd").innerHTML ="";
        
        if(newPwd!=pwd){
          document.getElementById("divNewPwd").innerHTML ="<span style='color=#cc0000'>两次输入的密码不一致!!!</span>";
          return false;
        }     
      	return true;
     } 
  </script>
	</head>

	<body>
		<div id="container">
			<div id="front">
				<jsp:include page="front.jsp" />
			</div>

			<div id="main">
				<div id="content">
					<form action="regis.cn" method="POST"
						onSubmit="return checkRegis();">
						<center>
							<div class="regis">
								<table>
									<tr>
										<td>请输入用户名:</td>
										<td><input  class="input-style" type="text" name="username" id="username" size="100" /></td>
										<td><div id="divName"></div></td>
									</tr>
									<tr>
										<td>请输入密码:</td>
										<td><input  class="input-style" type="password" name="userpwd" id="userpwd" /></td>
										<td><div id="divPwd"></div></td>
									</tr>
									<tr>
										<td>请再次输入密码:</td>
										<td><input class="input-style" type="password" name="reuserpwd" id="reuserpwd" /></td>
										<td><div id="divNewPwd"></div></td>
									</tr>
									<tr>
										<td>验证码:</td>
										<td><input class="input-style" type="text" name="code" /></td>
										<td></td>
									</tr>
									<tr>
										<td></td>
										<td><img src="image.cn" /><a href="JSP/blogjsp/regis.jsp">看不清</a></td>
										<td></td>
									</tr>
									<tr>
										<td></td>
										<td><input type="submit" value="提交" /></td>
										<td></td>
									</tr>
								</table>								
							</div>
						</center>
					</form>
				</div>
			</div>

			<jsp:include page="../footer.jsp"></jsp:include>
		</div>
	</body>
</html>
